
# 简单遍历算法查找子串第一个的位置
def strStr(haystack,needle):
    if needle == '': return 0
    length = len(needle)
    for i in range(len(haystack) - needle + 1):
        if haystack[i: i + length] == needle:
            return i
    return -1